﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuanLyBanHang.DAL;
using QuanLyBanHang.VO;

namespace QuanLyBanHang.BUS
{
    public class HoaDon_BUS
    {
        HoaDon_DAL hd_dal = new HoaDon_DAL();
        public bool insert(HoaDon_VO hd)
        {

            if (hd_dal.insertHD(out hd.MaHD, hd.MaNV, hd.MaKH, hd.TongGia))
            {
                foreach (CartItem c in hd.Items)
                {
                    hd_dal.insertCTHD(hd.MaHD, c.MaSP, c.soluong, c.gia);
                }
                return true;
            }
            else
                return false;
        }
    }
}
